/*
 * @description:
 * @version:
 * @Author: 王治飞
 * @Date: 2023-08-18 15:21:13
 * @LastEditors: 王治飞
 * @LastEditTime: 2023-08-22 16:14:46
 */
import PropTypes from 'prop-types'
import React, { memo } from 'react'
import Room from '../room'
import { RoomListWarp } from './style'
import ScorllView from '../scorllView'
const RoomList = memo(props => {
  const { list = [], col = 3, scorll = false } = props
  let showlist = list.slice(0, 8)
  return (
    <RoomListWarp>
      {!scorll ? (
        showlist.map(item => {
          return <Room info={item} key={item.id} width={(100 / col).toFixed(4)} />
        })
      ) : (
        <ScorllView>
          {showlist.map(item => {
            return <Room info={item} key={item.id} width={(100 / col).toFixed(4)} />
          })}
        </ScorllView>
      )}
    </RoomListWarp>
  )
})

RoomList.propTypes = {
  col: PropTypes.number,
  list: PropTypes.array
}

export default RoomList
